//
//  ViewController.m
//  XBShareDemo
//
//  Created by admin on 2018/5/18.
//  Copyright © 2018年 肖世恒. All rights reserved.
//

#import "ViewController.h"
#import <XBShareAPI/XBShareAPI.h>
#import "share.h"

@interface ViewController ()

@end

@implementation ViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    
    //注册
    [[XBOAuth defaultManager] setQQAppId:@"222222"];
    [[XBOAuth defaultManager] setWXAppId:@"wxd930ea5d5a258f4f"];
    [[XBOAuth defaultManager] setWeiboAppKey:@"2045436852"];
    
    

    
    
}

- (IBAction)openWX:(id)sender {
    
    
    
    [[share defaultManager] showXBShareQQTIMView];
    
//    [[XBShareManager defaultManager] openWXChatWithJumpName:@"cqdx01" extMsg:@"" completion:^(id result,NSError *error){
//        
//        //
//        NSLog(@"%@",error.userInfo[@"NSLocalizedDescription"]);
//        
//    }];
    
//    [[XBShareManager defaultManager] openWXChatWithWXNum:@"wxid_6fj86w3uehzd22" completion:^(id result,NSError *error){
//        
//        //
//        NSLog(@"%@",error.userInfo[@"NSLocalizedDescription"]);
//        
//    }];
    
//    [[XBShareManager defaultManager] openWXChatWithUrl:@"https://mp.weixin.qq.com/s/-Prj9rkznQw_uSkMQ-9YxQ" completion:^(id result,NSError *error){
//
//        //
//        NSLog(@"%@",error.userInfo[@"NSLocalizedDescription"]);
//
//    }];
}
- (IBAction)openQQ:(id)sender {
    //    // QQ 临时聊天
        [[XBShareManager defaultManager] openQQChatWith:XBSocialPlatformType_TimQZ QQNum:@"临时聊天的QQ号" completion:^(id result,NSError *error){
            NSLog(@"%@",error.userInfo[@"NSLocalizedDescription"]);
        }];
}
- (IBAction)openQQGurp:(id)sender {
    //申请 添加QQ 群
        [[XBShareManager defaultManager] openQQJoinGroupNumWithplatformType:XBSocialPlatformTypeQQAndTIM groupNum:@"" groupKey:@"" completion:^(id result,NSError *error){
    
            //
            NSLog(@"%@",error.userInfo[@"NSLocalizedDescription"]);
    
        }];
}
- (IBAction)openShare:(id)sender {
       // 分享 网址链接
        XBSocialMessageNewObject *newObject = [XBSocialMessageNewObject objectWithTitle:@"titile" description:@"neirong" WebUrl:[NSURL URLWithString:@"http://sports.qq.com/a/20120510/000650.htm"] previewImageURL:[NSURL URLWithString:@"http://img1.gtimg.com/sports/pics/hv1/87/16/1037/67435092.jpg"]];
    
        [[XBShareManager defaultManager] shareToPlatform:XBSocialPlatformTypeQQAndTIM ||XBSocialPlatformType_TimQZ messageObject:newObject completion:^(id result,NSError *error){
            if(error){
    
                NSLog(@"%@",error.userInfo[@"NSLocalizedDescription"]);
            }else{
                NSLog(@"%@",result[@"message"]);
            }
        }];
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}


@end
